﻿using System;
using System.Web.UI;
using System.IO;

namespace Creative.Website.Starter.Usercontrols.Dashboards
{
    public partial class EmailAFriendFormLogs : UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            var xmlFilePath = Server.MapPath("~/App_Data/email_a_friend_form_log.xml");

            // Check if XML file exists
            if (!File.Exists(xmlFilePath))
            {
                xsltResultsDiv.InnerHtml = "<div class='notice'><h2>Warning</h2><p>The email_a_friend_form_log.xml file does not containt any logs or does not exist.</p></div>";
                return;
            }

            var xsltFilePath = Server.MapPath("~/xslt/FormLog.xslt");
            xsltResultsDiv.InnerHtml = xmlFilePath.LoadHtml(xsltFilePath);
        }
    }
}

